<?php
header("Content-Type: text/html;charset=utf-8");
//去掉路由有/没/的区别
$app->add(new \App\Middlewares\TrailingSlashMiddleware($container));
//登录的路由设置
$app->get("/login","App\Controllers\UserController:login")->setname('login');
$app->get("/","App\Controllers\UserController:index")->setname('index');
$app->post("/logout","App\Controllers\UserController:logout")->setname('logout');
//登录请求
$app->post("/login","App\Controllers\UserController:postLogin");
$app->get("/error","App\Controllers\UserController:postError")->setname('Error');
$app->group('',function(){
$this->get("/index","App\Controllers\UserController:userIndex");
$this->post("/getName","App\Controllers\UserController:getName");
$this->post("/getEmail","App\Controllers\UserController:getEmail");
$this->get("/useradd","App\Controllers\UserController:userInsertForm");
$this->get("/userupdate","App\Controllers\UserController:userUpdateForm");
$this->post("/user/menu","App\Controllers\UserController:userMenu");
$this->post("/upload","App\Controllers\UserController:userloadForm");
$this->get("/roleList","App\Controllers\RoleController:roleListForm");
$this->get("/userrole","App\Controllers\RoleController:userRoleForm");
$this->get("/powerlist","App\Controllers\RoleController:powerListForm");
$this->post("/user/role","App\Controllers\RoleController:userRole");
$this->post("/getinfo","App\Controllers\UserController:getInfo");
$this->get("/roleadd","App\Controllers\RoleController:roleAddForm");
})->add(new \App\Middlewares\AuthMiddleware($container));
$app->group('',function(){
	$this->get("/user/list","App\Controllers\UserController:userList");
    $this->get("/user/add","App\Controllers\UserController:userAdd");  
    $this->get("/user/update","App\Controllers\UserController:userUpdate");
    $this->post("/user/delete","App\Controllers\UserController:userDelete");
    $this->post("/user/select","App\Controllers\UserController:userSelect");
    $this->get("/user/info","App\Controllers\UserController:userInfo");
    $this->get("/user/item","App\Controllers\UserController:userItem");
    $this->post("/role/add","App\Controllers\RoleController:roleAdd");
    $this->post("/role/delete","App\Controllers\RoleController:roleDelete");
    $this->post("/role/update","App\Controllers\RoleController:roleUpdate");
    $this->get("/role/list","App\Controllers\RoleController:roleList");
    $this->get("/power/list","App\Controllers\RoleController:powerList");

    $this->post("/user/add","App\Controllers\UserController:userAdd");
})->add(new \App\Middlewares\RoleMiddleware($container))->add(new \App\Middlewares\AuthMiddleware($container));

